import {defineStore} from 'pinia'
import axios from 'axios';
import { nanoid } from 'nanoid';
export const useLoveStore = defineStore('love',{
    //data
    state(){
        return {
            talkList:[
                {id:'aasda01',title:'哈哈哈'},
                {id:'aasda02',title:'你好啊'},
            ]
        }
    },
    //methods
    actions:{
        async getLoveTalk_store(){
            let {data:{content:title}} =  await axios.get('https://api.uomg.com/api/rand.qinghua?format=json');
            let obj = {id:nanoid(),title}
            this.talkList.unshift(obj)
        }
    },


    //computed
    getters:{}
})